home *** CD-ROM | disk | FTP | other *** search
- Path: vax.sbu.ac.uk!tonyh
- From: tonyh@vax.sbu.ac.uk
- Newsgroups: comp.lang.c++
- Subject: Problem calling LIB$FIND_FILE on VAX
- Date: 18 Jan 96 13:57:59 GMT
- Organization: South Bank University
- Message-ID: <1996Jan18.135759.1@vax.sbu.ac.uk>
- NNTP-Posting-Host: big.sbu.ac.uk
-
- Hi everyone,
-
- I'm having difficulty trying to call the lib$find_file(,,,,,,) VAX
- Run-Time-Library (RTL) command from within a C program. I think my
- problem is not with the parameters of the actual lib$ call itself,
- but with the "$descriptor" part that actually holds the values, I've
- been through the VAX manuals and the "descriptor" part is still unclear
- to me. Am I accessing it correctly?...
-
- I have listed the source code below the system message, the codes purpose
- is to list a file in the current directory using wildcards. The program
- compiles, links but when I run it I get the following mesage:
-
- %SYSTEM-F-ACCVIO, access violation, reason mask=01, virtual address=010E0102,
- PC
- =0003738A, PSL=03C00000
- %TRACE-F-TRACEBACK, symbolic stack dump follows
- module name routine name line rel PC abs PC
-
- 0003738A 0003738A
- 00033FFE 00033FFE
- 000341EC 000341EC
- LCALL main 2979 000000C7 000004CF
-
-
- Please can you email me with some advise, suggestions, or pointers
- on where I am going wrong as I cannot find an explanation for the
- "$descriptor" procedure documented in any of the VAX manuals,
- thanks in advance.
- *** Tony ***
-
-
- /********************************************************************
- Filename: lcall.c
-
- ******************************************************************/
-
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
-
- #include <descrip.h>
- #include <ssdef.h>
- #include <lib$routines.h>
-
- #include "scrn.h"
-
- struct dsc$descriptor_s *descriptor(char *string);
-
-
- /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
- main()
- {
- struct dsc$descriptor_s FileFound;
-
- unsigned long int ContexVar;
-
- char instr[256];
- int status;
-
- char FName[] = "l*.*";
- char ans;
-
- cls;
- printf("\n\t*** Hello Boyz ready to start? ***\n");
- ans = getchar();
-
- /* Here's where the fun starts */
-
- /* Assign values to structure variables */
- FileFound.dsc$w_length = 255;
- FileFound.dsc$a_pointer = instr;
- FileFound.dsc$b_class = DSC$K_CLASS_S;
- FileFound.dsc$b_dtype = DSC$K_DTYPE_T; /* char string */
-
- /* Call library function Lib$find_file(,,,,) */
- status = lib$find_file( descriptor( FName ), FileFound,
- ContexVar, 0, 0, 0, 1 );
-
- /* Check status */
- if (status == SS$_NORMAL) {
- FileFound.dsc$a_pointer[ FileFound.dsc$w_length ] = '\0';
- }
-
- lib$find_file_end( ContexVar );
-
- /* return (0); */
- }
-
- /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
- struct dsc$descriptor_s *descriptor(char *string)
- {
- static struct dsc$descriptor_s desc[20];
- static int count = -1;
-
- if (count == 20) {
- count = -1;
- }
- count++;
- desc[count].dsc$w_length = strlen(string);
- desc[count].dsc$a_pointer = string;
- desc[count].dsc$b_class = DSC$K_CLASS_S;
- desc[count].dsc$b_dtype = DSC$K_DTYPE_T;
-
- return(&desc[count]);
- }
-